package com.example.demo.service;

import com.example.demo.controller.UserController;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Slf4j  //获取日志对象
@Controller
public class UserService {
    //得到日志对象
//    private final static Logger log = LoggerFactory.getLogger(UserController.class);  //设置当前类的类型
    @ResponseBody
    @RequestMapping("/sayhi1")
    public void sayHi() {
        //利用log对象打印日志
        log.trace("我是trace");
        log.debug("我是debug");
        log.info("我是info");
        log.warn("我是warn");
        log.error("我是error");
    }
}
